<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="sealte.hvpms.pojo.UserCreate"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>仓鼠网上投票系统HVPMS</title>
<link href="css/modifyPassword.jsp.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script language=javascript>
function validatePassword(){
	var op = $('#op').val();
	var np1 = $('#np1').val();
	var np2 = $('#np2').val();
	var form = $('#submitForm');
	var reg = /^\s+|\s+$/g;
	op = op.replace(reg,"");
	np1 = np1.replace(reg,"");
	np2 = np2.replace(reg,"");
	if(op!=""){
		if(np1!=""){
			if(np2!=""){
				if(np1!=np2){
					alert("新密码与确认新密码不同！");
				}else{
					form.submit();
				}
			}else{
				alert("确认新密码不能为空！！");
			}
		}else{
			alert("新密码不能为空！！");
		}
	}else{
		alert("原密码不能为空！！");
	}
}
</script>
</head>
<body>
<%
		UserCreate uc = (UserCreate) session.getAttribute("UserCreate");
		if (uc != null) {
%>
<div id="num2">
	<h2><img src="images/user_home.png">&nbsp;个人信息--修改密码</h2>
</div>

<div id="num1">
<form action="UCModifyPassword" method="POST"  id="submitForm">
<table>

<tr><th>原密码：</th><td><input type="password" name="oldPassword" id="op"/></td></tr>

<tr><th>新密码：</th><td><input type="password" name="newPassword" id="np1"/></td></tr>
<tr><th>确认新密码：</th><td><input type="password" id="np2"/></td></tr>

<tr>
<td></td>
<td align="left">
<input type="button" value="修改" onclick="validatePassword()"/>
</td></tr>
</table>
<input type="hidden" value="<%=uc.getId() %>" name="id"/>
</form>
</div>
<span>
	<%
		String message_vp = (String)request.getAttribute("message_vp");
		String message_mp = (String)request.getAttribute("message_mp");
		if(message_vp!=null&&!message_vp.equals("OK")){
			out.println("["+message_vp+"]");
		}
		if(message_mp!=null&&!message_mp.equals("")){
			out.println("["+message_mp+"]");
		}
	 %>
</span>
<%
		} else {
			out.println("谢绝跨路径访问！");
		}
%>
</body>
</html>